/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package list;

import java.util.*;

/**
 * 
 * @author ericzhou
 */
public class TestCase {

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String[] args) {
		// TODO code application logic here
		int testCase = 2;
		if (testCase == 1) {
			MyLinkedList ll = new MyLinkedList();
			ll.add("1");
			ll.add("2");
			ll.add("3");
			ll.add("2");
			ll.add("4");
			ll.add(2, "two");
			ll.add(4, "four");
			ll.add(10, "end");
			// ll.add(0,"-1");
			System.out.println("Size is " + ll.size + ": " + ll.printAll());

			if (ll.contains("4")) {
				System.out.println("The list contains 4.");
			}

			System.out.println("Get index 2 = " + ll.get(2));

			System.out.println("1's index = " + ll.indexOf("1"));
			System.out.println("four's index = " + ll.indexOf("four"));

			System.out.println("2's last index = " + ll.lastIndexOf("2"));

			System.out.println("Remove index 5, the content = "
					+ ll.remove(5).toString());
			System.out.println("Size is " + ll.size + ": " + ll.printAll());

			System.out.println("Set index 3 to \"3\", the origin element is "
					+ ll.set(3, "3"));
			System.out.println("Size is " + ll.size + ": " + ll.printAll());

			System.out.println("Last = " + ll.last.getElement().toString());

			ll.removeFirst();
			System.out.println("Size is " + ll.size + ": " + ll.printAll());
			ll.removeLast();
			System.out.println("Size is " + ll.size + ": " + ll.printAll());

			System.out.println("Last = " + ll.last.getElement().toString());
			// System.out.println("Last.next = "+ll.last.next.getElement().toString());
			// System.out.println(ll.first.next.next.next.getElement().toString());
		} else if (testCase == 2) {

			MyStack stack = new MyStack();
			stack.push("stack1");
			stack.push("stack2");
			stack.pop();
			System.out.println(stack.pop().toString());
			stack.push("stack3");
			stack.push("stack4");
			stack.push("stack5");
			System.out.println(stack);
			
		}else if(testCase==3){
			Set<String> set = new HashSet<String>();
			set.add("London");
			set.add("Paris");
			set.add("New York");
			set.add("San Francisco");
			set.add("Beijing");
			set.add("New York");
			
			System.out.println(set);
			
			Iterator<String> iterator= set.iterator();
			//System.out.println(iterator);
			
			while (iterator.hasNext()){
				System.out.print(iterator.next()+" ");
			}
			
		}
	}
}
